﻿using System;
using System.Management.Automation;

namespace PsTest.Types 
{
    /// <summary>
    /// The TestState enumeration describes the possible states for a <see cref="TestResult"/>
    /// </summary>
    public enum TestState
    {
        /// <summary>Test has not run yet</summary>
        NotRun,
        /// <summary>Test is waiting to be run</summary>
        Pending,

        /// <summary>Test was aborted</summary>
        Aborted,

        /// <summary>Test failed</summary>
        Failed,

        /// <summary>Test is inconclusive</summary>
        Inconclusive,

        /// <summary>Test passed</summary>
        Passed
    }

    /// <summary>
    /// The TestResult collects the results that are generated by running a unittest.
    /// </summary>
    public class TestResult
    {
        /// <summary>
        /// The name of the file the UnitTest is located in.
        /// </summary>
		public string Filename { get; set; }

        /// <summary>
        /// The name of the UnitTest.
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// The state (outcome) of the UnitTest.
        /// </summary>
        public TestState State { get; set; }

        /// <summary>
        /// The duration measures the amount of time passed when executing the UnitTest.
        /// </summary>
        public TimeSpan Duration { get; set; }

        /// <summary>
        /// Any messages collected by the UnitTest.
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// The datarow used as a parameter for a data-driven UnitTest.
        /// </summary>
        public object DataRow { get; set; }
    }
}
